package com.appwoo.txtws.activity;

import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnDismissListener;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ExpandableListView;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.RelativeLayout;
import android.widget.SimpleExpandableListAdapter;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import com.appwoo.android.exception.NotFoundNetWorkException;
import com.appwoo.android.exception.TimeOutException;
import com.appwoo.txtws.app.AppActivity;
import com.appwoo.txtws.bean.MessageBean;
import com.appwoo.txtws.bean.SeniorListBean;
import com.appwoo.txtws.bean.ServerAppBean;
import com.appwoo.txtws.bean.StateBean;
import com.appwoo.txtws.bean.TimeConfigBean;
import com.appwoo.txtws.component.DBHelper;
import com.appwoo.txtws.component.GetDateTime;
import com.appwoo.txtws.component.Logger;
import com.appwoo.txtws.component.RqSP;
import com.appwoo.txtws.service.LimitTimeService;
import com.appwoo.txtws.service.TimerService;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.xmlpull.v1.XmlPullParserException;

public class TimeFunStuActivity extends AppActivity
  implements View.OnClickListener, RadioGroup.OnCheckedChangeListener
{
  private static final int DIALOG1 = 1;
  private static final int DIALOG2 = 2;
  private static final String NOTSELECT = "0";
  private static final String SCHOOL = "2";
  private static final String SELECT = "1";
  private int D_NOTSELECT = 0;
  private int D_SELECT = 0;
  private LinearLayout LinearLayout_timer_stage;
  private RelativeLayout RelativeLayout_select;
  private RelativeLayout RelativeLayout_timesenior;
  private List<SeniorListBean> SeniorListBean_list = null;
  private TextView TextView_seniortimer_tip;
  private SimpleExpandableListAdapter adapter = null;
  private String alertString = "";
  private Boolean blSelectAll = Boolean.valueOf(false);
  private TextView btn_senior_home;
  private TextView btn_senior_school;
  private CheckBox ckb_CloseNet;
  private CheckBox ckb_LockScreen;
  private String equipName;
  private ExpandableListView expandlist_senior;
  private ServerAppBean f_serverAppBean = null;
  private LimitTimeService f_service;
  private String f_strTime = "";
  private List<TextView> f_textview_list = null;
  private int firTextViewIndex = 0;
  private DBHelper helper = null;
  private MessageBean mBean = null;
  private String manageType;
  private int selectLog = 0;
  private TimeConfigBean tcfBean = null;
  private TextView tf_line_home;
  private TextView tf_line_school;
  private TimerService timerService;
  private String userid;
  private Button v_btn_limit_time_change;
  private ProgressDialog v_progressDialog;
  private TableLayout v_tablelayout_1;
  private TableLayout v_tablelayout_2;
  private TableLayout v_tablelayout_3;
  private TableLayout v_tablelayout_4;
  private TableLayout v_tablelayout_5;
  private TableLayout v_tablelayout_6;
  private TableLayout v_tablelayout_7;
  private RadioGroup v_weekTab;

  private void addListener()
  {
    this.btn_senior_home.setOnClickListener(this);
    this.btn_senior_school.setOnClickListener(this);
    this.v_btn_limit_time_change.setOnClickListener(this);
  }

  private String bgADtcf(String paramString)
  {
    if (paramString.equals("-1"))
      this.alertString = getString(2131427772);
    while (true)
    {
      return this.alertString;
      if (this.equipName != null)
        try
        {
          if (this.timerService == null)
            this.timerService = new TimerService();
          this.mBean = this.timerService.adTimeConfigCmdType(this.userid, this.equipName, paramString, this);
          if (!this.mBean.getCode().equals("0"))
            this.alertString = this.mBean.getDesc();
        }
        catch (IOException localIOException)
        {
          localIOException.printStackTrace();
          continue;
          this.alertString = "0";
        }
        catch (XmlPullParserException localXmlPullParserException)
        {
          localXmlPullParserException.printStackTrace();
        }
        catch (TimeOutException localTimeOutException)
        {
          localTimeOutException.printStackTrace();
        }
        catch (NotFoundNetWorkException localNotFoundNetWorkException)
        {
          localNotFoundNetWorkException.printStackTrace();
        }
    }
  }

  private String bgChangeLimit()
  {
    String str1 = "";
    int i = 1;
    Iterator localIterator = this.f_textview_list.iterator();
    while (true)
    {
      if (!localIterator.hasNext());
      try
      {
        String str2 = this.f_service.updateSoftLimitTime(this.userid, this.equipName, str1.substring(0, -1 + str1.length()), this).getCode();
        return str2;
        int j = Integer.parseInt(((TextView)localIterator.next()).getTag().toString()) % 2;
        if (i % 4 == 0);
        for (str1 = str1 + j + ","; ; str1 = str1 + j)
        {
          i++;
          break;
        }
      }
      catch (IOException localIOException)
      {
        this.alertString = getString(2131427524);
        return "";
      }
      catch (XmlPullParserException localXmlPullParserException)
      {
        this.alertString = getString(2131427524);
        return "";
      }
      catch (TimeOutException localTimeOutException)
      {
        this.alertString = getString(2131427526);
        return "";
      }
      catch (NotFoundNetWorkException localNotFoundNetWorkException)
      {
        localNotFoundNetWorkException.getClass();
        this.alertString = "没有连接到网络";
      }
    }
    return "";
  }

  private String bgInitTime()
  {
    if (!this.manageType.equalsIgnoreCase("home"))
      getList();
    this.f_strTime = "";
    try
    {
      this.f_strTime = this.f_service.getSoftLimitTime(this.userid, this.equipName, this);
      if ((this.f_strTime == null) || (this.f_strTime.length() == 0))
        this.f_strTime = "1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111";
      String str2 = this.f_strTime.substring(0, -1 + this.f_strTime.length());
      return str2;
    }
    catch (IOException localIOException)
    {
      str1 = getString(2131427525);
      return str1;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      while (true)
        str1 = getString(2131427525);
    }
    catch (TimeOutException localTimeOutException)
    {
      while (true)
        str1 = getString(2131427525);
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      while (true)
      {
        localNotFoundNetWorkException.getClass();
        String str1 = "没有连接到网络";
      }
    }
  }

  private String bgRQTimeConfig(Context paramContext)
  {
    if (this.equipName != null);
    try
    {
      this.tcfBean = this.timerService.RQTimeConfig(this.userid, this.equipName, paramContext);
      bgInitTime();
      String str = this.tcfBean.getCmdType();
      return str;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return this.alertString;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      while (true)
        localXmlPullParserException.printStackTrace();
    }
    catch (TimeOutException localTimeOutException)
    {
      while (true)
        localTimeOutException.printStackTrace();
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      while (true)
        localNotFoundNetWorkException.printStackTrace();
    }
    catch (Exception localException)
    {
      while (true)
        localException.printStackTrace();
    }
  }

  private String bgRQTimeConfig1(Context paramContext)
  {
    if (this.equipName != null);
    try
    {
      this.tcfBean = this.timerService.RQTimeConfig(this.userid, this.equipName, paramContext);
      getList();
      if (this.tcfBean != null)
        this.alertString = this.tcfBean.getCmdType1();
      return this.alertString;
    }
    catch (IOException localIOException)
    {
      while (true)
        localIOException.printStackTrace();
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      while (true)
        localXmlPullParserException.printStackTrace();
    }
    catch (TimeOutException localTimeOutException)
    {
      while (true)
        localTimeOutException.printStackTrace();
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      while (true)
        localNotFoundNetWorkException.printStackTrace();
    }
    catch (Exception localException)
    {
      while (true)
        localException.printStackTrace();
    }
  }

  private void bgRQWay1(String paramString)
  {
    if (paramString != null)
    {
      if ("0".equals(paramString))
        this.TextView_seniortimer_tip.setText(getString(2131427944) + "断网");
    }
    else
      return;
    if ("1".equals(paramString))
    {
      this.TextView_seniortimer_tip.setText(getString(2131427944) + "锁屏");
      return;
    }
    if ("2".equals(paramString))
    {
      this.TextView_seniortimer_tip.setText(getString(2131427944) + "锁屏+断网");
      return;
    }
    this.TextView_seniortimer_tip.setText(getString(2131427944));
  }

  private void chaneTimeStage()
  {
    if (dealWithProtect().equals("-1"))
    {
      alertMessage(getString(2131427772));
      return;
    }
    new Limit_TimeAsyncTask().execute(new String[] { "change" });
  }

  private List<SeniorListBean> chooseList(List<SeniorListBean> paramList, String paramString)
  {
    ArrayList localArrayList = new ArrayList();
    int i = paramList.size();
    for (int j = 0; ; j++)
    {
      if (j >= i)
        return localArrayList;
      SeniorListBean localSeniorListBean = (SeniorListBean)paramList.get(j);
      if (localSeniorListBean.getType().equals(paramString))
        localArrayList.add(localSeniorListBean);
    }
  }

  private void createOrShowDialog()
  {
    if ((this.v_progressDialog == null) || (!this.v_progressDialog.isShowing()))
    {
      this.v_progressDialog = new ProgressDialog(this);
      this.v_progressDialog.setMessage(getString(2131427516));
      this.v_progressDialog.setCancelable(true);
      if (!this.v_progressDialog.isShowing())
        this.v_progressDialog.show();
    }
  }

  private String dealWithProtect()
  {
    boolean bool1 = this.ckb_CloseNet.isChecked();
    boolean bool2 = this.ckb_LockScreen.isChecked();
    if ((bool1) && (bool2))
      return "2";
    if ((bool2) && (!bool1))
      return "1";
    if ((!bool2) && (bool1))
      return "0";
    return "-1";
  }

  private SimpleExpandableListAdapter getExAdapter(List<SeniorListBean> paramList)
  {
    String[] arrayOfString = new String[7];
    arrayOfString[0] = getString(2131427852);
    arrayOfString[1] = getString(2131427853);
    arrayOfString[2] = getString(2131427854);
    arrayOfString[3] = getString(2131427855);
    arrayOfString[4] = getString(2131427856);
    arrayOfString[5] = getString(2131427857);
    arrayOfString[6] = getString(2131427851);
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = new ArrayList();
    int i = 0;
    Integer[] arrayOfInteger;
    int k;
    if (i >= 7)
    {
      int j = paramList.size();
      arrayOfInteger = new Integer[7];
      arrayOfInteger[0] = Integer.valueOf(0);
      arrayOfInteger[1] = Integer.valueOf(0);
      arrayOfInteger[2] = Integer.valueOf(0);
      arrayOfInteger[3] = Integer.valueOf(0);
      arrayOfInteger[4] = Integer.valueOf(0);
      arrayOfInteger[5] = Integer.valueOf(0);
      arrayOfInteger[6] = Integer.valueOf(0);
      k = 0;
      if (k < j)
        break label281;
    }
    for (int n = 0; ; n++)
    {
      if (n >= 7)
      {
        this.adapter = new SimpleExpandableListAdapter(this, localArrayList1, 2130903102, new String[] { "group" }, new int[] { 2131493109 }, localArrayList2, 2130903101, new String[] { "child" }, new int[] { 2131493108 });
        return this.adapter;
        localArrayList2.add(new ArrayList());
        i++;
        break;
        label281: SeniorListBean localSeniorListBean = (SeniorListBean)paramList.get(k);
        int m = Integer.parseInt(localSeniorListBean.getWeek());
        String str1 = localSeniorListBean.getRemark();
        String str2 = localSeniorListBean.getHoliday();
        String str3 = localSeniorListBean.getCmdtype();
        if ((str1 != null) || ((str2 != null) && (str2.equals("1"))))
          arrayOfInteger[(m - 1)] = Integer.valueOf(1);
        String str4 = "";
        if ("0".equals(str3))
          str4 = getString(2131427777);
        while (true)
        {
          String str5 = localSeniorListBean.getStartime() + " —— " + localSeniorListBean.getEndtime() + "\t" + str4;
          HashMap localHashMap1 = new HashMap();
          localHashMap1.put("child", str5);
          ((List)localArrayList2.get(m - 1)).add(localHashMap1);
          k++;
          break;
          if ("1".equals(str3))
            str4 = getString(2131427778);
          else if ("2".equals(str3))
            str4 = getString(2131427778) + "+" + getString(2131427777);
        }
      }
      HashMap localHashMap2 = new HashMap();
      int i1 = ((List)localArrayList2.get(n)).size();
      int i2 = arrayOfInteger[n].intValue();
      String str6 = arrayOfString[n] + "（" + i1 + "）";
      if (i2 == 1)
        str6 = str6 + "\t" + getString(2131427950);
      localHashMap2.put("group", str6);
      localArrayList1.add(localHashMap2);
    }
  }

  private List<SeniorListBean> getList()
  {
    try
    {
      this.SeniorListBean_list = this.timerService.getSeniorList(this.userid, this.equipName, this);
      this.SeniorListBean_list = chooseList(this.SeniorListBean_list, "1");
      return this.SeniorListBean_list;
    }
    catch (IOException localIOException)
    {
      while (true)
        this.alertString = getString(2131427524);
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      while (true)
        this.alertString = getString(2131427524);
    }
    catch (TimeOutException localTimeOutException)
    {
      while (true)
        this.alertString = getString(2131427526);
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      while (true)
      {
        localNotFoundNetWorkException.getClass();
        this.alertString = "没有连接到网络";
      }
    }
  }

  private int getMaxIndexInt(int paramInt)
  {
    int i = -1;
    int j = this.SeniorListBean_list.size();
    Object localObject = "";
    for (int k = 0; ; k++)
    {
      if (k >= j)
      {
        if (!((String)localObject).equals(""))
        {
          String str2 = ((String)localObject).substring(0, 2);
          String str3 = ((String)localObject).substring(3, 5);
          if ((str2 != null) || (!str2.equals("")))
          {
            int m = Integer.parseInt(str2);
            int n = (Integer.parseInt(str3) + m * 60) / 15;
            if ((str3.equals("15")) || (str3.equals("30")) || (str3.equals("45")) || (str3.equals("00")))
              n--;
            if (paramInt == 7)
              paramInt = 0;
            i = n + paramInt * 96;
          }
        }
        return i;
      }
      SeniorListBean localSeniorListBean = (SeniorListBean)this.SeniorListBean_list.get(k);
      if (localSeniorListBean.getWeek().equals(paramInt))
      {
        String str1 = localSeniorListBean.getEndtime();
        if (((String)localObject).equals(""))
          localObject = str1;
        if (str1.compareToIgnoreCase((String)localObject) >= 0)
          localObject = str1;
      }
    }
  }

  private int getMinIndexInt(int paramInt)
  {
    int i = -1;
    this.SeniorListBean_list.size();
    Object localObject = "";
    for (int j = 0; ; j++)
    {
      if (j >= this.SeniorListBean_list.size())
      {
        if (!((String)localObject).equals(""))
        {
          String str2 = ((String)localObject).substring(0, 2);
          String str3 = ((String)localObject).substring(3, 5);
          if ((str2 != null) || (!str2.equals("")))
          {
            int k = Integer.parseInt(str2);
            int m = (Integer.parseInt(str3) + k * 60) / 15;
            if (paramInt == 7)
              paramInt = 0;
            i = m + paramInt * 96;
          }
        }
        return i;
      }
      if (((SeniorListBean)this.SeniorListBean_list.get(j)).getWeek().equals(paramInt))
      {
        String str1 = ((SeniorListBean)this.SeniorListBean_list.get(j)).getStartime();
        if (((String)localObject).equals(""))
          localObject = str1;
        if (str1.compareToIgnoreCase((String)localObject) < 0)
          localObject = str1;
      }
    }
  }

  private void getSeniorList()
  {
    new Limit_TimeAsyncTask().execute(new String[] { "getSeniorList" });
  }

  private void init()
  {
    this.helper = new DBHelper(this);
    this.f_serverAppBean = ((ServerAppBean)getApplication());
    this.f_service = new LimitTimeService();
    this.timerService = new TimerService();
    RqSP localRqSP = new RqSP();
    this.equipName = localRqSP.getLgDevId(this);
    this.manageType = localRqSP.getLgDevMange(this);
    this.userid = localRqSP.getLgDevAccount(this);
    this.expandlist_senior = ((ExpandableListView)findViewById(2131493603));
    this.btn_senior_home = ((TextView)findViewById(2131493596));
    this.btn_senior_school = ((TextView)findViewById(2131493597));
    this.tf_line_home = ((TextView)findViewById(2131493598));
    this.tf_line_school = ((TextView)findViewById(2131493599));
    this.RelativeLayout_select = ((RelativeLayout)findViewById(2131493136));
    this.TextView_seniortimer_tip = ((TextView)findViewById(2131493601));
    this.RelativeLayout_timesenior = ((RelativeLayout)findViewById(2131493600));
    this.LinearLayout_timer_stage = ((LinearLayout)findViewById(2131493582));
    this.v_btn_limit_time_change = ((Button)findViewById(2131493595));
    this.D_NOTSELECT = 2130838115;
    this.D_SELECT = 2130838117;
    this.v_tablelayout_1 = ((TableLayout)findViewById(2131493586));
    this.v_tablelayout_2 = ((TableLayout)findViewById(2131493587));
    this.v_tablelayout_3 = ((TableLayout)findViewById(2131493588));
    this.v_tablelayout_4 = ((TableLayout)findViewById(2131493589));
    this.v_tablelayout_5 = ((TableLayout)findViewById(2131493590));
    this.v_tablelayout_6 = ((TableLayout)findViewById(2131493591));
    this.v_tablelayout_7 = ((TableLayout)findViewById(2131493592));
    this.ckb_LockScreen = ((CheckBox)findViewById(2131493593));
    this.ckb_LockScreen.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
    {
      public void onCheckedChanged(CompoundButton paramAnonymousCompoundButton, boolean paramAnonymousBoolean)
      {
      }
    });
    this.ckb_CloseNet = ((CheckBox)findViewById(2131493594));
    this.ckb_CloseNet.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
    {
      public void onCheckedChanged(CompoundButton paramAnonymousCompoundButton, boolean paramAnonymousBoolean)
      {
      }
    });
    this.f_textview_list = new ArrayList();
    this.v_weekTab = ((RadioGroup)findViewById(2131493583));
    this.v_weekTab.setOnCheckedChangeListener(this);
    initTables();
    alertMessage(getString(2131427943));
  }

  private void initActionBar()
  {
    hideBarHome();
    setBarTitle(getResources().getString(2131427344));
    setBarBackOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        TimeFunStuActivity.this.finish();
      }
    });
  }

  private void initTable(TableLayout paramTableLayout)
  {
    TableRow localTableRow = new TableRow(this);
    final int i = paramTableLayout.getId();
    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    int j = localDisplayMetrics.widthPixels;
    System.out.println("分辨率：width-" + localDisplayMetrics.widthPixels + "\theight-" + localDisplayMetrics.heightPixels);
    int m;
    if ((localDisplayMetrics.widthPixels > 540) && (localDisplayMetrics.heightPixels > 960))
      m = 8001280;
    int i1;
    while (true)
    {
      i1 = 0;
      if (i1 < 24)
        break;
      return;
      if ((localDisplayMetrics.widthPixels == 480) && (localDisplayMetrics.heightPixels >= 800) && (localDisplayMetrics.heightPixels < 960))
      {
        m = 480800;
      }
      else if ((localDisplayMetrics.widthPixels == 540) && (localDisplayMetrics.heightPixels == 960))
      {
        m = 540960;
      }
      else if ((localDisplayMetrics.widthPixels == 480) && (localDisplayMetrics.heightPixels == 960))
      {
        m = 540960;
      }
      else
      {
        int k = localDisplayMetrics.widthPixels;
        m = 0;
        if (k == 480)
        {
          int n = localDisplayMetrics.heightPixels;
          m = 0;
          if (n < 800)
            m = 480;
        }
      }
    }
    final RelativeLayout localRelativeLayout = new RelativeLayout(this);
    localRelativeLayout.setTag(Integer.valueOf(i1));
    Object localObject1 = new ViewGroup.LayoutParams(80, 40);
    Object localObject2 = new ViewGroup.LayoutParams(20, 40);
    ViewGroup.LayoutParams localLayoutParams1 = new ViewGroup.LayoutParams(120, 40);
    ViewGroup.LayoutParams localLayoutParams2 = new ViewGroup.LayoutParams(30, 40);
    ViewGroup.LayoutParams localLayoutParams3 = new ViewGroup.LayoutParams(120, 60);
    ViewGroup.LayoutParams localLayoutParams4 = new ViewGroup.LayoutParams(30, 60);
    ViewGroup.LayoutParams localLayoutParams5 = new ViewGroup.LayoutParams(135, 70);
    ViewGroup.LayoutParams localLayoutParams6 = new ViewGroup.LayoutParams(34, 70);
    ViewGroup.LayoutParams localLayoutParams7 = new ViewGroup.LayoutParams(j / 4, 80);
    ViewGroup.LayoutParams localLayoutParams8 = new ViewGroup.LayoutParams(j / 16, 80);
    label446: TextView localTextView1;
    LinearLayout localLinearLayout;
    if (m == 8001280)
    {
      localObject1 = localLayoutParams7;
      localObject2 = localLayoutParams8;
      localTextView1 = new TextView(this);
      localTextView1.setBackgroundResource(2130838116);
      localTextView1.setLayoutParams((ViewGroup.LayoutParams)localObject1);
      localLinearLayout = new LinearLayout(this);
    }
    for (int i2 = 0; ; i2++)
    {
      if (i2 >= 4)
      {
        TextView localTextView2 = new TextView(this);
        localTextView2.setText(i1 + ":00");
        localTextView2.setGravity(17);
        localTextView2.setTextColor(-16777216);
        localTextView2.setBackgroundColor(0);
        localTextView2.setLayoutParams((ViewGroup.LayoutParams)localObject1);
        localRelativeLayout.addView(localTextView1);
        localRelativeLayout.addView(localLinearLayout);
        localRelativeLayout.addView(localTextView2);
        localTableRow.addView(localRelativeLayout);
        localTableRow.setGravity(17);
        if ((i1 == 3) || (i1 == 7) || (i1 == 11) || (i1 == 15) || (i1 == 19) || (i1 == 23))
        {
          paramTableLayout.addView(localTableRow);
          localTableRow = new TableRow(this);
        }
        View.OnLongClickListener local6 = new View.OnLongClickListener()
        {
          public boolean onLongClick(View paramAnonymousView)
          {
            int i = -1;
            int k;
            int m;
            switch (i)
            {
            default:
              TimeFunStuActivity.this.firTextViewIndex = (i * 96 + 4 * ((Integer)localRelativeLayout.getTag()).intValue());
              int j = TimeFunStuActivity.this.firTextViewIndex;
              k = 0;
              m = j;
              label89: if (m >= j + 4)
              {
                if (k <= 3)
                  break label196;
                TimeFunStuActivity.this.alertMessage(TimeFunStuActivity.this.getString(2131427945));
              }
              break;
            case 2131493586:
            case 2131493587:
            case 2131493588:
            case 2131493589:
            case 2131493590:
            case 2131493591:
            case 2131493592:
            }
            while (true)
            {
              return false;
              i = 0;
              break;
              i = 1;
              break;
              i = 2;
              break;
              i = 3;
              break;
              i = 4;
              break;
              i = 5;
              break;
              i = 6;
              break;
              if (Integer.parseInt(((TextView)TimeFunStuActivity.this.f_textview_list.get(m)).getTag().toString()) > 1)
                k++;
              m++;
              break label89;
              label196: TimeFunStuActivity.this.showDialog(2);
            }
          }
        };
        localRelativeLayout.setOnLongClickListener(local6);
        View.OnClickListener local7 = new View.OnClickListener()
        {
          public void onClick(View paramAnonymousView)
          {
            int i = -1;
            int j;
            int k;
            switch (i)
            {
            default:
              TimeFunStuActivity.this.firTextViewIndex = (i * 96 + 4 * ((Integer)localRelativeLayout.getTag()).intValue());
              j = TimeFunStuActivity.this.firTextViewIndex;
              k = 0;
            case 2131493586:
            case 2131493587:
            case 2131493588:
            case 2131493589:
            case 2131493590:
            case 2131493591:
            case 2131493592:
            }
            for (int m = j; ; m++)
            {
              int n = j + 4;
              int i1 = 0;
              if (m >= n);
              int i2;
              while (true)
              {
                if (i1 == 0)
                  break label216;
                TimeFunStuActivity.this.alertMessage(TimeFunStuActivity.this.getString(2131427945));
                return;
                i = 0;
                break;
                i = 1;
                break;
                i = 2;
                break;
                i = 3;
                break;
                i = 4;
                break;
                i = 5;
                break;
                i = 6;
                break;
                i2 = Integer.parseInt(((TextView)TimeFunStuActivity.this.f_textview_list.get(m)).getTag().toString());
                if (i2 <= 1)
                  break label202;
                i1 = 1;
              }
              label202: if (i2 == 0)
                k = 1;
            }
            label216: int i3 = j;
            label219: TextView localTextView;
            if (i3 < j + 4)
            {
              localTextView = (TextView)TimeFunStuActivity.this.f_textview_list.get(i3);
              if (k == 0)
                break label266;
              TimeFunStuActivity.this.setSelect(localTextView);
            }
            while (true)
            {
              i3++;
              break label219;
              break;
              label266: TimeFunStuActivity.this.setNoSelect(localTextView);
            }
          }
        };
        localRelativeLayout.setOnClickListener(local7);
        i1++;
        break;
        if (m == 480800)
        {
          localObject1 = localLayoutParams3;
          localObject2 = localLayoutParams4;
          break label446;
        }
        if (m == 540960)
        {
          localObject1 = localLayoutParams5;
          localObject2 = localLayoutParams6;
          break label446;
        }
        if (m != 480)
          break label446;
        localObject1 = localLayoutParams1;
        localObject2 = localLayoutParams2;
        break label446;
      }
      TextView localTextView3 = new TextView(this);
      localTextView3.setBackgroundColor(0);
      localTextView3.setLayoutParams((ViewGroup.LayoutParams)localObject2);
      localLinearLayout.setLayoutParams((ViewGroup.LayoutParams)localObject1);
      localTextView3.setTag("1");
      localLinearLayout.addView(localTextView3);
      this.f_textview_list.add(localTextView3);
    }
  }

  private void initTables()
  {
    initTable(this.v_tablelayout_1);
    initTable(this.v_tablelayout_2);
    initTable(this.v_tablelayout_3);
    initTable(this.v_tablelayout_4);
    initTable(this.v_tablelayout_5);
    initTable(this.v_tablelayout_6);
    initTable(this.v_tablelayout_7);
  }

  private void initTimer()
  {
    new Limit_TimeAsyncTask().execute(new String[] { "rqTime" });
  }

  private Dialog loginoutbuildDialog(Context paramContext)
  {
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(paramContext);
    localBuilder.setIcon(2130837508);
    localBuilder.setTitle(getString(2131427588));
    localBuilder.setPositiveButton(getString(2131427513), new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        new TimeFunStuActivity.Limit_TimeAsyncTask(TimeFunStuActivity.this).execute(new String[] { "del" });
      }
    });
    localBuilder.setNegativeButton(getString(2131427514), new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
      }
    });
    return localBuilder.create();
  }

  private void postADtcf(String paramString)
  {
    if (!paramString.equals(""))
    {
      alertMessage(this.alertString);
      return;
    }
    alertMessage(getString(2131427528));
  }

  private void postInitTime(String paramString)
  {
    if ((this.f_strTime == null) || (this.f_strTime.equals("")))
    {
      alertMessage(getString(2131427910));
      return;
    }
    setTableOutTime();
    int i = GetDateTime.transDateTime(((ServerAppBean)getApplication()).getNowDate()).getDay();
    Logger.e("bod", "星期几" + i);
    switch (i)
    {
    default:
      return;
    case 0:
      this.v_weekTab.check(2131493370);
      return;
    case 1:
      this.v_weekTab.check(2131493219);
      return;
    case 2:
      this.v_weekTab.check(2131493221);
      return;
    case 3:
      this.v_weekTab.check(2131493223);
      return;
    case 4:
      this.v_weekTab.check(2131493224);
      return;
    case 5:
      this.v_weekTab.check(2131493584);
      return;
    case 6:
    }
    this.v_weekTab.check(2131493585);
  }

  private void postRQtcf(String paramString)
  {
    if (!paramString.equals(""))
    {
      if (!paramString.equals("0"))
        break label35;
      this.ckb_LockScreen.setChecked(false);
      this.ckb_CloseNet.setChecked(true);
    }
    label35: 
    do
    {
      return;
      if (paramString.equals("1"))
      {
        this.ckb_LockScreen.setChecked(true);
        this.ckb_CloseNet.setChecked(false);
        return;
      }
    }
    while (!paramString.equals("2"));
    this.ckb_LockScreen.setChecked(true);
    this.ckb_CloseNet.setChecked(true);
  }

  private void radioShow(TableLayout paramTableLayout)
  {
    this.v_tablelayout_1.setVisibility(8);
    this.v_tablelayout_2.setVisibility(8);
    this.v_tablelayout_3.setVisibility(8);
    this.v_tablelayout_4.setVisibility(8);
    this.v_tablelayout_5.setVisibility(8);
    this.v_tablelayout_6.setVisibility(8);
    this.v_tablelayout_7.setVisibility(8);
    paramTableLayout.setVisibility(0);
  }

  private void setNoSelect(TextView paramTextView)
  {
    paramTextView.setTag("0");
    paramTextView.setBackgroundResource(this.D_SELECT);
  }

  private void setSchool(TextView paramTextView)
  {
    paramTextView.setTag(Integer.valueOf(Integer.parseInt(paramTextView.getTag().toString()) + Integer.parseInt("2")));
    paramTextView.setBackgroundColor(getResources().getColor(2131230725));
  }

  private void setSchoolSeniorTime()
  {
    int i = 0;
    while (true)
    {
      if (i >= 7)
        return;
      int j;
      int k;
      int m;
      if (i == 0)
      {
        j = 7;
        k = 0;
        m = 0;
        if (-1 == 0);
      }
      try
      {
        k = getMaxIndexInt(j);
        m = getMinIndexInt(j);
        Logger.e("xjf", "week--->" + j + "\tmax--->" + k + "\tmin--->" + m);
        if ((-1 != m) && (-1 != k) && (k >= m))
        {
          n = m;
          if (n < k + 1);
        }
        else
        {
          i++;
          continue;
          j = i;
        }
      }
      catch (Exception localException1)
      {
        while (true)
        {
          int n;
          try
          {
            localException1.printStackTrace();
          }
          catch (Exception localException2)
          {
            localException2.printStackTrace();
            return;
          }
          setSchool((TextView)this.f_textview_list.get(n));
          n++;
        }
      }
    }
  }

  private void setSelect(TextView paramTextView)
  {
    paramTextView.setTag("1");
    paramTextView.setBackgroundColor(0);
  }

  private void setTableOutTime()
  {
    int i = 168;
    String[] arrayOfString;
    if ((this.f_strTime != null) && (!this.f_strTime.equals("")))
    {
      arrayOfString = this.f_strTime.split(",");
      if (arrayOfString.length <= i)
        break label65;
    }
    int j;
    while (true)
    {
      j = 0;
      if (j < i)
        break;
      if (!this.manageType.equalsIgnoreCase("home"))
        setSchoolSeniorTime();
      return;
      label65: i = arrayOfString.length;
    }
    int k = 0;
    while (true)
    {
      if (k >= 4)
      {
        j++;
        break;
      }
      TextView localTextView = (TextView)this.f_textview_list.get(k + j * 4);
      try
      {
        String str2 = arrayOfString[j].charAt(k);
        str1 = str2;
        if (str1.equals("1"))
        {
          setSelect(localTextView);
          k++;
        }
      }
      catch (Exception localException)
      {
        while (true)
        {
          String str1 = "1";
          continue;
          setNoSelect(localTextView);
        }
      }
    }
  }

  private void showHelpDialog(Context paramContext)
  {
    View localView = LayoutInflater.from(paramContext).inflate(2130903093, null);
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(paramContext);
    localBuilder.setTitle(getString(2131427946));
    localBuilder.setView(localView);
    localBuilder.setPositiveButton(getString(2131427513), null);
    localBuilder.show();
  }

  private void showHome()
  {
    this.selectLog = 0;
    this.tf_line_home.setVisibility(0);
    this.tf_line_school.setVisibility(4);
    this.RelativeLayout_timesenior.setVisibility(8);
    this.LinearLayout_timer_stage.setVisibility(0);
    initTimer();
  }

  private void showSchool()
  {
    this.selectLog = 1;
    this.tf_line_home.setVisibility(4);
    this.tf_line_school.setVisibility(0);
    this.RelativeLayout_timesenior.setVisibility(0);
    this.LinearLayout_timer_stage.setVisibility(8);
    new Limit_TimeAsyncTask().execute(new String[] { "way" });
  }

  private void showSeniorList()
  {
    try
    {
      this.expandlist_senior.setAdapter(getExAdapter(this.SeniorListBean_list));
      return;
    }
    catch (Exception localException)
    {
    }
  }

  private void showView()
  {
    new Limit_TimeAsyncTask().execute(new String[] { "init" });
  }

  private void showdelList(String paramString)
  {
    if (paramString.equals("0"))
    {
      alertMessage(getString(2131427517));
      getSeniorList();
    }
  }

  private Dialog udTimeDialog()
  {
    View localView = getLayoutInflater().inflate(2130903094, null);
    final Dialog localDialog = new Dialog(this, 2131361811);
    localDialog.setContentView(localView);
    final TextView localTextView1 = (TextView)localView.findViewById(2131493095);
    final TextView localTextView2 = (TextView)localView.findViewById(2131493096);
    final TextView localTextView3 = (TextView)localView.findViewById(2131493097);
    final TextView localTextView4 = (TextView)localView.findViewById(2131493098);
    Button localButton = (Button)localView.findViewById(2131493099);
    TextView[] arrayOfTextView = { localTextView1, localTextView2, localTextView3, localTextView4 };
    int i = 0;
    if (i >= 4)
    {
      localTextView1.setOnClickListener(new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          if (localTextView1.getTag().equals("1"))
          {
            localTextView1.setTag("0");
            localTextView1.setBackgroundResource(2130837792);
            ((TextView)TimeFunStuActivity.this.f_textview_list.get(0 + TimeFunStuActivity.this.firTextViewIndex)).setTag("0");
            return;
          }
          if (localTextView1.getTag().equals("0"))
          {
            localTextView1.setTag("1");
            localTextView1.setBackgroundResource(2130837790);
            ((TextView)TimeFunStuActivity.this.f_textview_list.get(0 + TimeFunStuActivity.this.firTextViewIndex)).setTag("1");
            return;
          }
          TimeFunStuActivity.this.alertMessage(TimeFunStuActivity.this.getString(2131427945));
        }
      });
      localTextView2.setOnClickListener(new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          if (localTextView2.getTag().equals("1"))
          {
            localTextView2.setTag("0");
            localTextView2.setBackgroundResource(2130837811);
            ((TextView)TimeFunStuActivity.this.f_textview_list.get(1 + TimeFunStuActivity.this.firTextViewIndex)).setTag("0");
            return;
          }
          if (localTextView2.getTag().equals("0"))
          {
            localTextView2.setTag("1");
            localTextView2.setBackgroundResource(2130837809);
            ((TextView)TimeFunStuActivity.this.f_textview_list.get(1 + TimeFunStuActivity.this.firTextViewIndex)).setTag("1");
            return;
          }
          TimeFunStuActivity.this.alertMessage(TimeFunStuActivity.this.getString(2131427945));
        }
      });
      localTextView3.setOnClickListener(new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          if (localTextView3.getTag().equals("1"))
          {
            localTextView3.setTag("0");
            localTextView3.setBackgroundResource(2130837811);
            ((TextView)TimeFunStuActivity.this.f_textview_list.get(2 + TimeFunStuActivity.this.firTextViewIndex)).setTag("0");
            return;
          }
          if (localTextView3.getTag().equals("0"))
          {
            localTextView3.setTag("1");
            localTextView3.setBackgroundResource(2130837809);
            ((TextView)TimeFunStuActivity.this.f_textview_list.get(2 + TimeFunStuActivity.this.firTextViewIndex)).setTag("1");
            return;
          }
          TimeFunStuActivity.this.alertMessage(TimeFunStuActivity.this.getString(2131427945));
        }
      });
      localTextView4.setOnClickListener(new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          if (localTextView4.getTag().equals("1"))
          {
            localTextView4.setTag("0");
            localTextView4.setBackgroundResource(2130837864);
            ((TextView)TimeFunStuActivity.this.f_textview_list.get(3 + TimeFunStuActivity.this.firTextViewIndex)).setTag("0");
            return;
          }
          if (localTextView4.getTag().equals("0"))
          {
            localTextView4.setTag("1");
            localTextView4.setBackgroundResource(2130837860);
            ((TextView)TimeFunStuActivity.this.f_textview_list.get(3 + TimeFunStuActivity.this.firTextViewIndex)).setTag("1");
            return;
          }
          TimeFunStuActivity.this.alertMessage(TimeFunStuActivity.this.getString(2131427945));
        }
      });
      localButton.setOnClickListener(new View.OnClickListener()
      {
        public void onClick(View paramAnonymousView)
        {
          localDialog.dismiss();
          int i = TimeFunStuActivity.this.f_textview_list.size();
          int j = 0;
          if (j >= i)
            return;
          TextView localTextView = (TextView)TimeFunStuActivity.this.f_textview_list.get(j);
          String str = localTextView.getTag();
          if (str.equals("1"))
            TimeFunStuActivity.this.setSelect(localTextView);
          while (true)
          {
            j++;
            break;
            if (str.equals("0"))
              TimeFunStuActivity.this.setNoSelect(localTextView);
            else
              TimeFunStuActivity.this.setSchool(localTextView);
          }
        }
      });
      localDialog.setOnDismissListener(new DialogInterface.OnDismissListener()
      {
        public void onDismiss(DialogInterface paramAnonymousDialogInterface)
        {
          if (paramAnonymousDialogInterface != null)
            TimeFunStuActivity.this.removeDialog(2);
        }
      });
      return localDialog;
    }
    String str = ((TextView)this.f_textview_list.get(i + this.firTextViewIndex)).getTag().toString();
    if (str.equals("1"))
    {
      arrayOfTextView[i].setTag("1");
      if (i == 0)
        arrayOfTextView[i].setBackgroundResource(2130837790);
    }
    while (true)
    {
      i++;
      break;
      if (i == 3)
      {
        arrayOfTextView[i].setBackgroundResource(2130837860);
      }
      else
      {
        arrayOfTextView[i].setBackgroundResource(2130837809);
        continue;
        if (str.equals("0"))
        {
          arrayOfTextView[i].setTag("0");
          if (i == 0)
            arrayOfTextView[i].setBackgroundResource(2130837792);
          else if (i == 3)
            arrayOfTextView[i].setBackgroundResource(2130837864);
          else
            arrayOfTextView[i].setBackgroundResource(2130837811);
        }
        else
        {
          arrayOfTextView[i].setTag(str);
          if (i == 0)
            arrayOfTextView[i].setBackgroundResource(2130837791);
          else if (i == 3)
            arrayOfTextView[i].setBackgroundResource(2130837863);
          else
            arrayOfTextView[i].setBackgroundResource(2130837810);
        }
      }
    }
  }

  public ArrayList<String> Sort(ArrayList<String> paramArrayList)
  {
    int i = 0;
    if (i >= paramArrayList.size())
      return paramArrayList;
    int j = paramArrayList.size();
    for (int k = 0; ; k++)
    {
      if (k >= j - 1)
      {
        (j - 1);
        i++;
        break;
      }
      String str1 = (String)paramArrayList.get(k);
      String str2 = (String)paramArrayList.get(k + 1);
      if (str1.compareToIgnoreCase(str2) >= 0)
      {
        paramArrayList.set(k, str2);
        paramArrayList.set(k + 1, str1);
      }
    }
  }

  protected void backKeyCallBack()
  {
    super.backKeyCallBack();
    finish();
  }

  public void onBackPressed()
  {
    super.onBackPressed();
    finish();
  }

  public void onCheckedChanged(RadioGroup paramRadioGroup, int paramInt)
  {
    switch (paramInt)
    {
    default:
      return;
    case 2131493370:
      radioShow(this.v_tablelayout_1);
      return;
    case 2131493219:
      radioShow(this.v_tablelayout_2);
      return;
    case 2131493221:
      radioShow(this.v_tablelayout_3);
      return;
    case 2131493223:
      radioShow(this.v_tablelayout_4);
      return;
    case 2131493224:
      radioShow(this.v_tablelayout_5);
      return;
    case 2131493584:
      radioShow(this.v_tablelayout_6);
      return;
    case 2131493585:
    }
    radioShow(this.v_tablelayout_7);
  }

  public void onClick(View paramView)
  {
    if (paramView == this.btn_senior_home)
      showHome();
    do
    {
      return;
      if (paramView == this.btn_senior_school)
      {
        showSchool();
        return;
      }
    }
    while (paramView != this.v_btn_limit_time_change);
    chaneTimeStage();
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    setContentView(2130903220);
    init();
    initActionBar();
    addListener();
  }

  protected Dialog onCreateDialog(int paramInt)
  {
    if (paramInt == 1)
      return loginoutbuildDialog(this);
    if (paramInt == 2)
      return udTimeDialog();
    return null;
  }

  protected void onResume()
  {
    super.onResume();
    showHome();
  }

  public class Limit_TimeAsyncTask extends AsyncTask<String, Integer, String>
  {
    private String method = "";

    public Limit_TimeAsyncTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      this.method = paramArrayOfString[0];
      if (this.method != null)
      {
        if (!this.method.equals("getSeniorList"))
          break label39;
        TimeFunStuActivity.this.getList();
      }
      label39: 
      do
      {
        String str = "";
        do
        {
          return str;
          if (this.method.equals("rqTime"))
            return TimeFunStuActivity.this.bgRQTimeConfig(TimeFunStuActivity.this);
          if (this.method.equals("init"))
            return TimeFunStuActivity.this.bgInitTime();
          if (!this.method.equals("change"))
            break;
          str = TimeFunStuActivity.this.bgChangeLimit();
        }
        while (!"0".equals(str));
        return TimeFunStuActivity.this.bgADtcf(TimeFunStuActivity.access$4(TimeFunStuActivity.this));
      }
      while (!this.method.equals("way"));
      return TimeFunStuActivity.this.bgRQTimeConfig1(TimeFunStuActivity.this);
    }

    protected void onPostExecute(String paramString)
    {
      if (this.method.equals("getSeniorList"))
        TimeFunStuActivity.this.showSeniorList();
      try
      {
        while (true)
        {
          TimeFunStuActivity.this.v_progressDialog.dismiss();
          return;
          if (this.method.equals("rqTime"))
          {
            if (paramString != null)
              TimeFunStuActivity.this.postRQtcf(paramString);
            TimeFunStuActivity.this.postInitTime(paramString);
          }
          else if (this.method.equals("init"))
          {
            TimeFunStuActivity.this.postInitTime(paramString);
          }
          else if (this.method.equals("change"))
          {
            if (paramString.equals("0"))
              TimeFunStuActivity.this.alertMessage(TimeFunStuActivity.this.getString(2131427527));
            else
              TimeFunStuActivity.this.alertMessage(TimeFunStuActivity.this.getString(2131427528));
          }
          else if (this.method.equals("way"))
          {
            TimeFunStuActivity.this.bgRQWay1(paramString);
            TimeFunStuActivity.this.showSeniorList();
          }
        }
      }
      catch (Exception localException)
      {
      }
    }

    protected void onPreExecute()
    {
      TimeFunStuActivity.this.createOrShowDialog();
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.TimeFunStuActivity
 * JD-Core Version:    0.6.2
 */